# -*- coding:utf-8 -*-
# @FileName  :1.selenium基础用法.py
# @Time      :2024/8/15 上午9:53
# @Author    :鲁大师
import time
from selenium import webdriver
'''


'''

import requests
from lxml import etree

# 实现了游览器对象·
bro = webdriver.Edge()
url = 'http://www.cqxs.gov.cn/'
bro.get(url)
time.sleep(1)
heads = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0"
}
# page = requests.get(url=url, headers=heads).text
# 获取浏览器页面源码数据
page_text = bro.page_source
tree = etree.HTML(page_text)

table_list = tree.xpath('//*[@id="ml1"]/ul/li')
for table in table_list:
    img_src = table.xpath('./a/@title')[0]
    time.sleep(1)
    print("title",img_src)
time.sleep(3)
bro.quit()
